<!--<!DOCTYPE html>

<html>

	<head>
		<meta charset="utf-8">
		<title>车协官网后台管理</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="format-detection" content="telephone=no">

		<link rel="stylesheet" href="/admin/plugins/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="/admin/css/global.css" media="all">
		<link rel="stylesheet" href="/admin/plugins/font-awesome/css/font-awesome.min.css">

	</head>

	<body>
		<div class="layui-layout layui-layout-admin">
			<div class="layui-header header header-demo">
				<div class="layui-main">
					<div class="admin-login-box">
						<a class="logo" style="left: 0;" href="http://beginner.zhengjinfan.cn/demo/beginner_admin/">
							<span style="font-size: 22px;">后台管理</span>
						</a>
						<div class="admin-side-toggle">
							<i class="fa fa-bars" aria-hidden="true"></i>
						</div>
					</div>
					<ul class="layui-nav admin-header-item">
						<li class="layui-nav-item">
							<span>欢迎您<%=host%>:</span>
						</li>
						<li class="layui-nav-item">
							<a href="/" target="_blank">浏览网站</a>
						</li>
						<li class="layui-nav-item" >
							<a href="/logout"><i class="fa fa-sign-out"></i> 注销</a>
						</li>

					</ul>

				</div>
			</div>
			<div class="layui-side layui-bg-black" id="admin-side">
				<div class="layui-side-scroll" id="admin-navbar-side" lay-filter="side"></div>
			</div>
			<div class="layui-body" style="bottom: 0;border-left: solid 2px #1AA094;" id="admin-body">
				<div class="layui-tab admin-nav-card layui-tab-brief" lay-filter="admin-tab">
					<ul class="layui-tab-title">
						<li class="layui-this">
							<i class="fa fa-dashboard" aria-hidden="true"></i>
							<cite>主页</cite>
						</li>
					</ul>-->
					<%include common/include_header.html%>
					<div class="layui-tab-content" style="min-height: 150px; padding: 5px 0 0 0;">
						<div>
							<div style="margin: 15px;">
	<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
		<legend>添加管理员</legend>
	</fieldset>

	<form class="layui-form" action="">
		<div class="layui-form-item">
			<label class="layui-form-label">用户名</label>
			<div class="layui-input-block">
				<input type="text" id="username" name="username"  autocomplete="off" placeholder="请输入用户名" class="layui-input">
			</div>
		</div>

		<div class="layui-form-item">
			<label class="layui-form-label">密码</label>
			<div class="layui-input-block">
				<input type="text" id="password" name="password"  autocomplete="off" placeholder="请输入密码" class="layui-input">
			</div>
		</div>


		<div class="layui-form-item">
			<label class="layui-form-label">真实姓名</label>
			<div class="layui-input-block">
				<input type="text" id="realname" name="realname"  autocomplete="off" placeholder="请输入真实姓名" class="layui-input">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">电话号码</label>
			<div class="layui-input-block">
				<input type="text" id="phone" name="phone"  autocomplete="off" placeholder="请输入电话号码" class="layui-input">
			</div>
		</div>


		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" id="add">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
</div>
						</div>
					</div>
				
			<%include common/include_footer.html%>

			
			<script type="text/javascript" src="/admin/plugins/layui/layui.js"></script>
			<!--<script type="text/javascript" src="/admin/datas/nav.js"></script>-->
			<script src="/admin/js/index1.js"></script>
			<script>
				layui.use(['form', 'laydate','upload'], function() {
		var form = layui.form(),
				layer = layui.layer,
				laydate = layui.laydate,
				$= layui.jquery;


		//监听提交
		//点击添加分类
		$('#add').on('click', function() {
			var username=$("#username").val();
			var password=$("#password").val();
			var realname=$("#realname").val();
			var phone=$("#phone").val();
			//测试用户是否录入信息
			if(username==""||password==""||realname==""){
				layer.alert('请填入相关信息', {icon: 2});
				return;
			}
			$.post("/admin/post_user",{username:username,password:password,realname:realname,phone:phone},function(result){
				if(result.status==="success"){
					layer.alert('添加成功,请在离职管理员列表查看。', {icon: 1});
				}else if(result.status==="noRight"){
					layer.alert('非超级管理员，无权添加！', {icon: 2});
				}
				else if(result.status==="user_exist"){
					layer.alert('用户已存在，请勿重复添加！', {icon: 2});
				}
				else{
					layer.alert('添加失败！', {icon: 2});
				}
			});
			//这句话的意思不会刷新当前页面。避免清空内容
			return false;
		});
	});
			</script>
		</div>
	</body>

</html>